#include <iostream>
#include <cmath>

using namespace std;

int main()
{
   int i,n;
   float xdeg,xrad,term,sum;
   cout<<"Enter the value of x in degree :";
   cin>>xdeg;
   cout<<"Enter the number of terms n:";
   cin>>n;
   xrad=(xdeg*3.14)/180;
   term=sum=1;
   for(i=2;i<=n;i++)
   {
       term*=(-xrad*xrad)/((2.0*i-3)*(2.0*i-2));
       sum+=term;
   }
   cout<<"cos("<<xdeg<<")="<<sum<<endl;
   cin.get();
}
